package com.xiyueyezi.xiyueyezi.service;

/**
 * @author Xiyueyezi
 * @Description
 * @since 2024-2024/6 9:45
 */
public class LoginService {

    public void startLogin(String username, String password, LoginCallback callback) {
        new Thread(() -> {
            try {
                Thread.sleep(1000); //TODO: 模拟网络请求
                //登录成功
                callback.onSuccess("login success");
            } catch (InterruptedException e) {
                callback.onFailure("login failed");
            }
        }).start();
    }

    //登录结果回调接口
    public interface LoginCallback {
        void onSuccess(String result);
        void onFailure(String error);
    }
}
